package com.api.sw.duban.util;

import weaver.conn.RecordSet;
import weaver.general.Util;

import java.math.BigDecimal;

/*
    报表转换 类
    add by 福福大帝  2020/11/18
 */
public class BbTrance {
    private final static LogTool log = new LogTool("/log/duban/",false);
    /*
        个人统计事项总数
     */
    /*
        个人统计办理中事项
     */
    /*
        个人统计
     */
    /*
        个人统计办结率
     */
    //param0  人员加类型  param1 条件 param2 任务总数
    public String getSingleRwCount(String param0,String param1,String  param2){
        String result="";
        //条件采用字符串拼接

        log.writeLog("getSingleRwCountparam0--->"+param0);
        log.writeLog("getSingleRwCountparam1--->"+param1);
        log.writeLog("getSingleRwCountparam2--->"+param2);
        int param2Count=Util.getIntValue(param2,0);//任务总数
        RecordSet re=new RecordSet();
        String DBType=re.getDBType();

        param0= Util.null2String(param0).trim();
        param1= Util.null2String(param1).trim();
        if("".equals(param0)||param1.split(",").length!=4){
            return "-1";
        }
        String userid=param0.split(",")[0];
        String lx=param0.split(",")[1];
        String paramDate="";
        String wheresql=" 1=1 ";
        if(!"".equals(param1)){
            String[] param1s=param1.split(",");
            if(!"-1".equals(Util.null2String(param1s[1]).trim())){
                if("6".equals(Util.null2String(param1s[1]).trim())){
                    if(!"".equals(Util.null2String(param1s[2]).trim())){
                        wheresql=wheresql+" and substr(modedatacreatedate,0,10)>='"+Util.null2String(param1s[2]).trim()+"'";
                    }
                    if(!"".equals(Util.null2String(param1s[3]).trim())){
                        wheresql=wheresql+" and substr(modedatacreatedate,0,10)<='"+Util.null2String(param1s[3]).trim()+"'";
                    }
                }else{
                    if("sqlserver".equals(DBType)){
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(modedatacreatedate,0,10)");
                    }else{
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(modedatacreatedate,0,10)");
                    }
                }
            }
        }
        String sql="";
        if("0".equals(lx)){//常规
             sql="select count(1) bjcount from uf_dcsxzb  where isnull(zt,-1) in (2) and modedatacreater='"+userid+"' and "+wheresql;
             log.writeLog(sql);
        }else{//决策
             sql=" select count(1) bjcount from  uf_jcdcrw where isnull(sfsrw,-1)=0 and isnull(zt,-1) in (2) and modedatacreater='"+userid+"' and "+wheresql;
             log.writeLog(sql);
        }
        int bjcount=0;
        re.execute(sql);
        while(re.next()){
            bjcount=Util.getIntValue(re.getString("bjcount"),0);
        }
        //用字符串拼接  0办理中事项  1已办结事项  2办结率
        int blz=param2Count-bjcount;//办理中事项
        String bjl=getSe(bjcount+"",param2Count+"");
        return blz+","+bjcount+","+bjl;
    }
    public String getDwRwCount(String param0,String param1,String  param2){
        String result="";
        //条件采用字符串拼接

        log.writeLog("getSingleRwCountparam0--->"+param0);
        log.writeLog("getSingleRwCountparam1--->"+param1);
        log.writeLog("getSingleRwCountparam2--->"+param2);
        int param2Count=Util.getIntValue(param2,0);//任务总数
        RecordSet re=new RecordSet();
        String DBType=re.getDBType();

        param0= Util.null2String(param0).trim();
        param1= Util.null2String(param1).trim();
        if("".equals(param0)||param1.split(",").length!=4){
            return "-1";
        }
        String dwid=param0.split(",")[0];
        String lx=param0.split(",")[1];
        String paramDate="";
        String wheresql=" 1=1 ";
        if(!"".equals(param1)){
            String[] param1s=param1.split(",");
            if(!"-1".equals(Util.null2String(param1s[1]).trim())){
                if("6".equals(Util.null2String(param1s[1]).trim())){
                    if(!"".equals(Util.null2String(param1s[2]).trim())){
                        wheresql=wheresql+" and substr(modedatacreatedate,0,10)>='"+Util.null2String(param1s[2]).trim()+"'";
                    }
                    if(!"".equals(Util.null2String(param1s[3]).trim())){
                        wheresql=wheresql+" and substr(modedatacreatedate,0,10)<='"+Util.null2String(param1s[3]).trim()+"'";
                    }
                }else{
                    if("sqlserver".equals(DBType)){
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(modedatacreatedate,0,10)");
                    }else{
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(modedatacreatedate,0,10)");
                    }
                }
            }
        }
        String sql="";
        if("0".equals(lx)){//常规
            sql="select count(1) bjcount from uf_dbjblb  where isnull(zt,-1) in (2) and dw='"+dwid+"' and "+wheresql;
            log.writeLog(sql);
        }else{//决策
            sql=" select count(1) bjcount from  uf_jcrwfk where  isnull(bjzt,-1) in (2) and qtdw='"+dwid+"' and "+wheresql;
            log.writeLog(sql);
        }
        int bjcount=0;
        re.execute(sql);
        while(re.next()){
            bjcount=Util.getIntValue(re.getString("bjcount"),0);
        }
        //用字符串拼接  0办理中事项  1已办结事项  2办结率
        int blz=param2Count-bjcount;//办理中事项
        String bjl=getSe(bjcount+"",param2Count+"");
        return blz+","+bjcount+","+bjl;
    }
    /*
        未签收  已签收  param0 param1 条件  param2 单位+类型
     */
    public String getRwQs(String param0,String param1,String param2){
        String result="";
        //条件采用字符串拼接

        log.writeLog("getSingleRwCountparam0--->"+param0);//暂时没有参数
        log.writeLog("getSingleRwCountparam1--->"+param1);
        log.writeLog("getSingleRwCountparam2--->"+param2);
        RecordSet re=new RecordSet();
        String DBType=re.getDBType();

        param0= Util.null2String(param0).trim();
        param1= Util.null2String(param1).trim();
        if("".equals(param2)||param1.split(",").length!=4){
            return "-1";
        }
        String dwid=param2.split(",")[0];
        String lx=param2.split(",")[1];
        String paramDate="";
        String wheresql=" 1=1 ";
        if(!"".equals(param1)){
            String[] param1s=param1.split(",");
            if(!"-1".equals(Util.null2String(param1s[1]).trim())){
                if("6".equals(Util.null2String(param1s[1]).trim())){
                    if(!"".equals(Util.null2String(param1s[2]).trim())){
                        wheresql=wheresql+" and substr(modedatacreatedate,0,10)>='"+Util.null2String(param1s[2]).trim()+"'";
                    }
                    if(!"".equals(Util.null2String(param1s[3]).trim())){
                        wheresql=wheresql+" and substr(modedatacreatedate,0,10)<='"+Util.null2String(param1s[3]).trim()+"'";
                    }
                }else{
                    if("sqlserver".equals(DBType)){
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(modedatacreatedate,0,10)");
                    }else{
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(modedatacreatedate,0,10)");
                    }
                }
            }
        }
        String sql="";
        if("0".equals(lx)){//常规
            sql="select count(1) bjcount,'0' lx from uf_dbjblb  where isnull(zt,-1) in (0) and dw='"+dwid+"' and   "+wheresql+
                " union all " +
                " select count(1) bjcount,'1' lx from uf_dbjblb  where isnull(zt,-1) in (1) and dw='"+dwid+"' and   "+wheresql;
            log.writeLog(sql);
        }else{//决策
            sql=" select count(1) bjcount,'0' lx from  uf_jcrwfk where  isnull(qszt,-1) in (0) and qtdw='"+dwid+"' and "+wheresql+
                " union all" +
                " select count(1) bjcount,'1' lx from  uf_jcrwfk where  isnull(qszt,-1) in (1) and qtdw='"+dwid+"' and "+wheresql;
            log.writeLog(sql);
        }
        int yqscount=0;
        int wqsscount=0;
        re.execute(sql);
        while(re.next()){
           String lx1=Util.null2String(re.getString("lx"));
           if("0".equals(lx1)){
               wqsscount=Util.getIntValue(re.getString("bjcount"),0);
           }
            if("1".equals(lx1)){
                yqscount=Util.getIntValue(re.getString("bjcount"),0);
            }
        }

        return wqsscount+","+yqscount;
    }
    /*
        超时签收 param0 param1 条件  param2 单位+类型
     */

    public String getRwOverTimeQs(String param0,String param1,String param2){
        String result="";
        //条件采用字符串拼接

        log.writeLog("getSingleRwCountparam0--->"+param0);//暂时没有参数
        log.writeLog("getSingleRwCountparam1--->"+param1);
        log.writeLog("getSingleRwCountparam2--->"+param2);
        RecordSet re=new RecordSet();
        String DBType=re.getDBType();

        param0= Util.null2String(param0).trim();
        param1= Util.null2String(param1).trim();
        if("".equals(param2)||param1.split(",").length!=4){
            return "-1";
        }
        String dwid=param2.split(",")[0];
        String lx=param2.split(",")[1];
        String paramDate="";
        String wheresql=" 1=1 ";
        if(!"".equals(param1)){
            String[] param1s=param1.split(",");
            if(!"-1".equals(Util.null2String(param1s[1]).trim())){
                if("6".equals(Util.null2String(param1s[1]).trim())){
                    if(!"".equals(Util.null2String(param1s[2]).trim())){
                        wheresql=wheresql+" and substr(modedatacreatedate,0,10)>='"+Util.null2String(param1s[2]).trim()+"'";
                    }
                    if(!"".equals(Util.null2String(param1s[3]).trim())){
                        wheresql=wheresql+" and substr(modedatacreatedate,0,10)<='"+Util.null2String(param1s[3]).trim()+"'";
                    }
                }else{
                    if("sqlserver".equals(DBType)){
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(modedatacreatedate,0,10)");
                    }else{
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(modedatacreatedate,0,10)");
                    }
                }
            }
        }
        String sql="";
        if("0".equals(lx)){//常规
            sql="select count(1) bjcount,'0' lx from uf_dbjblb  where isnull(zt,-1) in (1) and length(jssx)>0 and length(sjjsrq)>0 and substring(jssx,0,16)<substring(sjjsrq,0,16) and dw='"+dwid+"' and   "+wheresql;
            log.writeLog(sql);
        }else{//决策
            sql=" select count(1) bjcount from  uf_jcrwfk where  isnull(qszt,-1) in (1) and length(qssx)>0 and length(qssj)>0 and substring(qssx,0,16)<substring(qssj,0,16) and qtdw='"+dwid+"' and "+wheresql;
            log.writeLog(sql);
        }
        int overTimescount=0;

        re.execute(sql);
        while(re.next()){
            overTimescount=Util.getIntValue(re.getString("bjcount"));

        }
        //用字符串拼接  0办理中事项  1已办结事项  2办结率

        return overTimescount+"";
    }
    /*
        超时反馈  param0 param1 条件  param2 单位+类型
     */
    public String getRwOverTimeFk(String param0,String param1,String param2){
        String result="";
        //条件采用字符串拼接

        log.writeLog("getSingleRwCountparam0--->"+param0);//暂时没有参数
        log.writeLog("getSingleRwCountparam1--->"+param1);
        log.writeLog("getSingleRwCountparam2--->"+param2);
        RecordSet re=new RecordSet();
        String DBType=re.getDBType();

        param0= Util.null2String(param0).trim();
        param1= Util.null2String(param1).trim();
        if("".equals(param2)||param1.split(",").length!=4){
            return "-1";
        }
        String dwid=param2.split(",")[0];
        String lx=param2.split(",")[1];
        String paramDate="";
        String wheresql=" 1=1 ";
        if(!"".equals(param1)){
            String[] param1s=param1.split(",");
            if(!"-1".equals(Util.null2String(param1s[1]).trim())){
                if("6".equals(Util.null2String(param1s[1]).trim())){
                    if(!"".equals(Util.null2String(param1s[2]).trim())){
                        wheresql=wheresql+" and substr(c.modedatacreatedate,0,10)>='"+Util.null2String(param1s[2]).trim()+"'";
                    }
                    if(!"".equals(Util.null2String(param1s[3]).trim())){
                        wheresql=wheresql+" and substr(c.modedatacreatedate,0,10)<='"+Util.null2String(param1s[3]).trim()+"'";
                    }
                }else{
                    if("sqlserver".equals(DBType)){
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(c.modedatacreatedate,0,10)");
                    }else{
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(c.modedatacreatedate,0,10)");
                    }
                }
            }
        }
        String sql="";
        if("0".equals(lx)){//常规
            sql="select count(1) bjcount from (select a.rwid,a.id,a.fkyqsj,b.modedatacreatedate||' '||substring( b.modedatacreatetime,0,5) createdate,row_number() over(partition by a.id order by b.modedatacreatedate||' '||substring( b.modedatacreatetime,0,5)   ) as rowNum1 " +
                "   from uf_fksxjlbnew a,uf_rwfkb b,uf_dbjblb c where a.id=b.fksxjlid and isnull(b.zt,-1) in (-1,0) and a.jbjlid=c.id and c.dw='"+dwid+"' and "+wheresql+" ) where rowNum1=1 and createdate>fkyqsj ";
            log.writeLog(sql);
        }else{//决策
            sql="select count(1) bjcount from uf_rwqtdwsx a,uf_jcdcrw c where isnull(a.shzt,-1) in (0) and length(a.yqfksx)>0 and length(a.sjfksx)>0 and a.yqfksx<a.sjfksx and a.fkrwid=c.id and a.qtdw='"+dwid+"' and "+wheresql;
            log.writeLog(sql);
        }
        int overTimescount=0;

        re.execute(sql);
        while(re.next()){
            overTimescount=Util.getIntValue(re.getString("bjcount"));

        }
        //用字符串拼接  0办理中事项  1已办结事项  2办结率

        return overTimescount+"";
    }
    /*
        总的反馈数  param0 param1 条件  param2 单位+类型
     */

    public String getRwFkAll(String param0,String param1,String param2){
        String result="";
        //条件采用字符串拼接

        log.writeLog("getSingleRwCountparam0--->"+param0);//暂时没有参数
        log.writeLog("getSingleRwCountparam1--->"+param1);
        log.writeLog("getSingleRwCountparam2--->"+param2);
        RecordSet re=new RecordSet();
        String DBType=re.getDBType();

        param0= Util.null2String(param0).trim();
        param1= Util.null2String(param1).trim();
        if("".equals(param2)||param1.split(",").length!=4){
            return "-1";
        }
        String dwid=param2.split(",")[0];
        String lx=param2.split(",")[1];
        String paramDate="";
        String wheresql=" 1=1 ";
        if(!"".equals(param1)){
            String[] param1s=param1.split(",");
            if(!"-1".equals(Util.null2String(param1s[1]).trim())){
                if("6".equals(Util.null2String(param1s[1]).trim())){
                    if(!"".equals(Util.null2String(param1s[2]).trim())){
                        wheresql=wheresql+" and substr(c.modedatacreatedate,0,10)>='"+Util.null2String(param1s[2]).trim()+"'";
                    }
                    if(!"".equals(Util.null2String(param1s[3]).trim())){
                        wheresql=wheresql+" and substr(c.modedatacreatedate,0,10)<='"+Util.null2String(param1s[3]).trim()+"'";
                    }
                }else{
                    if("sqlserver".equals(DBType)){
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(c.modedatacreatedate,0,10)");
                    }else{
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(c.modedatacreatedate,0,10)");
                    }
                }
            }
        }
        String sql="";
        if("0".equals(lx)){//常规
            sql="select count(1) bjcount from uf_rwfkb a,uf_dbjblb c where a.jbjlid=c.id and c.dw='"+dwid+"' and  "+wheresql;
            log.writeLog(sql);
        }else{//决策
            sql="select count(1) bjcount from uf_jcdclsfkjl a,uf_jcrwfk c where a.fkrwid=c.id and a.qtdw='"+dwid+"' and "+wheresql;
            log.writeLog(sql);
        }
        int overTimescount=0;

        re.execute(sql);
        while(re.next()){
            overTimescount=Util.getIntValue(re.getString("bjcount"));

        }
        //用字符串拼接  0办理中事项  1已办结事项  2办结率

        return overTimescount+"";
    }
    /*
        延期、驳回、催办 param0 param1 条件  param2 单位+类型
     */


    public String getRwFkyqorcborbh(String param0,String param1,String param2){
        String result="";
        //条件采用字符串拼接

        log.writeLog("getSingleRwCountparam0--->"+param0);//暂时没有参数
        log.writeLog("getSingleRwCountparam1--->"+param1);
        log.writeLog("getSingleRwCountparam2--->"+param2);
        RecordSet re=new RecordSet();
        String DBType=re.getDBType();

        param0= Util.null2String(param0).trim();
        param1= Util.null2String(param1).trim();
        if("".equals(param2)||param1.split(",").length!=4){
            return "-1";
        }
        String dwid=param2.split(",")[0];
        String lx=param2.split(",")[1];
        String paramDate="";
        String wheresql=" 1=1 ";
        if(!"".equals(param1)){
            String[] param1s=param1.split(",");
            if(!"-1".equals(Util.null2String(param1s[1]).trim())){
                if("6".equals(Util.null2String(param1s[1]).trim())){
                    if(!"".equals(Util.null2String(param1s[2]).trim())){
                        wheresql=wheresql+" and substr(c.modedatacreatedate,0,10)>='"+Util.null2String(param1s[2]).trim()+"'";
                    }
                    if(!"".equals(Util.null2String(param1s[3]).trim())){
                        wheresql=wheresql+" and substr(c.modedatacreatedate,0,10)<='"+Util.null2String(param1s[3]).trim()+"'";
                    }
                }else{
                    if("sqlserver".equals(DBType)){
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(c.modedatacreatedate,0,10)");
                    }else{
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(c.modedatacreatedate,0,10)");
                    }
                }
            }
        }
        String sql="";
        //0:延期 1：驳回 2：催办
        if("0".equals(lx)){//常规
                sql="select count(1) count1 ,'0' lx from uf_sqjlb a,uf_dbjblb c where a.jbjlbid=c.id and c.dw='"+dwid+"'  and "+wheresql+
                    "   union all " +
                    "   select count(1) count1 ,'1' lx  from uf_rwfkb a,uf_dbjblb c where a.jbjlid=c.id and a.zt=1 and c.dw='"+dwid+"' and  "+wheresql+
                    "   union all " +
                    "   select count(1) count1 ,'2' lx from uf_cbjlb a,uf_dbjblb c where a.jbjlid=c.id  and c.dw='"+dwid+"' and "+wheresql;
            log.writeLog(sql);
        }else{//决策
                sql=" select count(1) count1 ,'0' lx from uf_jcdcrwyqsq a,uf_jcrwfk c where a.fkrwid=c.id and c.qtdw='"+dwid+"'  and " +wheresql+
                    "   union all " +
                    "   select count(1) count1 ,'1' lx from uf_jcdclsfkjl a,uf_jcrwfk c where a.fkrwid=c.id  and isnull(fkzt,-1)=2 and c.qtdw='"+dwid+"' and " +wheresql+
                    "   union all " +
                    "   select 0 count1 ,'2' lx";
            log.writeLog(sql);
        }
        int yq=0;
        int bh=0;
        int cb=0;

        re.execute(sql);
        while(re.next()){
            String lx1=Util.null2String(re.getString("lx"));
            if("0".equals(lx1)){
                yq=Util.getIntValue(re.getString("count1"));
            }
            if("1".equals(lx1)){
                bh=Util.getIntValue(re.getString("count1"));
            }
            if("2".equals(lx1)){
                cb=Util.getIntValue(re.getString("count1"));
            }


        }
        //用字符串拼接  0办理中事项  1已办结事项  2办结率

        return yq+","+bh+","+cb;
    }
    /*
            类型统计办结率
         */
    //param0  类型  param1 条件 param2 任务总数
    public String getLxRwCount(String param0,String param1,String  param2){
        String result="";
        //条件采用字符串拼接

        log.writeLog("getSingleRwCountparam0--->"+param0);
        log.writeLog("getSingleRwCountparam1--->"+param1);
        log.writeLog("getSingleRwCountparam2--->"+param2);
        int param2Count=Util.getIntValue(param2,0);//任务总数
        RecordSet re=new RecordSet();
        String DBType=re.getDBType();

        param0= Util.null2String(param0).trim();
        param1= Util.null2String(param1).trim();
        if("".equals(param0)||param1.split(",").length!=3){
            return "-1";
        }
        //String userid=param0.split(",")[0];
        String lx=param0;//.split(",")[1];
        String paramDate="";
        String wheresql=" 1=1 ";
        if(!"".equals(param1)){
            String[] param1s=param1.split(",");
            if(!"-1".equals(Util.null2String(param1s[1]).trim())){
                if("6".equals(Util.null2String(param1s[1]).trim())){
                    if(!"".equals(Util.null2String(param1s[2]).trim())){
                        wheresql=wheresql+" and substr(modedatacreatedate,0,10)>='"+Util.null2String(param1s[2]).trim()+"'";
                    }
                    if(!"".equals(Util.null2String(param1s[3]).trim())){
                        wheresql=wheresql+" and substr(modedatacreatedate,0,10)<='"+Util.null2String(param1s[3]).trim()+"'";
                    }
                }else{
                    if("sqlserver".equals(DBType)){
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(modedatacreatedate,0,10)");
                    }else{
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(modedatacreatedate,0,10)");
                    }
                }
            }
        }
        String sql="";
        if("0".equals(lx)){//常规
            sql="select count(1) bjcount  from uf_dbjblb where isnull(zt,01) in (2) and "+wheresql;
            log.writeLog(sql);
        }else{//决策
            sql=" select count(1) bjcount  from uf_jcrwfk where isnull(bjzt,01) in (1) and "+wheresql;
            log.writeLog(sql);
        }
        int bjcount=0;
        re.execute(sql);
        while(re.next()){
            bjcount=Util.getIntValue(re.getString("bjcount"),0);
        }
        //用字符串拼接  0办理中事项  1已办结事项  2办结率
        int blz=param2Count-bjcount;//办理中事项
        String bjl=getSe(bjcount+"",param2Count+"");
        return blz+","+bjcount+","+bjl;
    }
    /*
          类型统计通知  param0 param1 条件  param2 单位+类型
       */
    public String getRwTzCount(String param0,String param1,String param2){
        String result="";
        //条件采用字符串拼接

        log.writeLog("getSingleRwCountparam0--->"+param0);//暂时没有参数
        log.writeLog("getSingleRwCountparam1--->"+param1);
        log.writeLog("getSingleRwCountparam2--->"+param2);
        RecordSet re=new RecordSet();
        String DBType=re.getDBType();

        param0= Util.null2String(param0).trim();
        param1= Util.null2String(param1).trim();
        if("".equals(param2)||param1.split(",").length!=3){
            return "-1";
        }
        //String dwid=param2.split(",")[0];
        String lx=param2;//.split(",")[1];
        String paramDate="";
        String wheresql=" 1=1 ";
        if(!"".equals(param1)){
            String[] param1s=param1.split(",");
            if(!"-1".equals(Util.null2String(param1s[1]).trim())){
                if("6".equals(Util.null2String(param1s[1]).trim())){
                    if(!"".equals(Util.null2String(param1s[2]).trim())){
                        wheresql=wheresql+" and substr(c.modedatacreatedate,0,10)>='"+Util.null2String(param1s[2]).trim()+"'";
                    }
                    if(!"".equals(Util.null2String(param1s[3]).trim())){
                        wheresql=wheresql+" and substr(c.modedatacreatedate,0,10)<='"+Util.null2String(param1s[3]).trim()+"'";
                    }
                }else{
                    if("sqlserver".equals(DBType)){
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(c.modedatacreatedate,0,10)");
                    }else{
                        wheresql=wheresql+DubUtil.getRQfW(Util.null2String(param1s[1]).trim(),"substr(c.modedatacreatedate,0,10)");
                    }
                }
            }
        }
        String sql="";
        //0:延期 1：驳回 2：催办
        if("0".equals(lx)){//常规
            sql="select count(1) bjcount  from uf_dcsxzb where "+wheresql;
            log.writeLog(sql);
        }else{//决策
            sql=" select count(1) bjcount  from uf_jcdctz where "+wheresql;
            log.writeLog(sql);
        }
        int yq=0;
        re.execute(sql);
        while(re.next()){
                yq=Util.getIntValue(re.getString("bjcount"));
        }
        //用字符串拼接  0办理中事项  1已办结事项  2办结率
        log.writeLog("yq"+yq);
        return yq+"";
    }
    /*
        除法去取两位小数
     */
    public static String getSe(String hs,String sl){
        String se="0";
        try{
            if(Util.getDoubleValue(hs, 0)==0){
                hs="0";
            }
            if(Util.getDoubleValue(sl, 0)==0){
                sl="0";
            }
            BigDecimal hsD=new BigDecimal(hs);
            BigDecimal slD=new BigDecimal(sl);
            //BigDecimal hsD=new BigDecimal(hs);
            se=hsD.divide(slD,2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).toString();

        }catch(Exception e){
            e.printStackTrace();
        }
        return se;
    }
    public static void main(String[] arg){
            System.out.println(getSe("12","13"));
    }

}
